/*----------------------------------------------------------------------------
Owner(s): Shane Whitfield
$Copyright: $
$Id: 

Purpose  : 
----------------------------------------------------------------------------*/

#pragma once

#include "singleton.h"
#include "nncommand.h"
#include <vector>
#include <string>

/*--------------------------------------------------------------------------*/
// Class CSound declaration.
class CSound
{
public:

			CSound(unsigned int i_soundId);
			
	void	Play();
	void	Stop();

private:

	unsigned int	m_soundId;
};

/*--------------------------------------------------------------------------*/
// Class CSoundMgr declaration.
class CSoundMgr : public TSingleton<CSoundMgr>, public CCommandTaker, public CSubsystem
{
	typedef CSubsystem super;
public:
			CSoundMgr();
			
			
	//CCommandTaker Overrides
	virtual const char*	GetName() const {
							return "sound"; }
	virtual void		On_Command(const char* i_command, const char* i_parameters);
			
	void				SetIsSoundOn(bool i_is);
	CSound*				CreateSound(const char* i_filename);
    CSound*				GetLoadedSound(const char* i_fileName);	
	void				Play(const CSound* i_sound);
	void				Stop(const CSound* i_sound);
	
	static void			SetSystemSoundLoader(bool (*systemsoundloader)(const char* i_filename, unsigned int& o_soundId));
	static void			SetSystemSoundPlay(bool (*systemsoundplay)(unsigned int i_soundId));
	
private:

	enum EState
	{
		EState_On,
		EState_Mute,
	};
	
	void setState(EState i_state);
	
	EState						m_state;
	std::vector<CSound*>		m_sounds;
	std::vector<std::string>	m_soundFileNames;
};

inline CSoundMgr& CSoundMgr_GetSingleton() { return CSoundMgr::GetSingleton(); }
#define g_soundmgr (CSoundMgr_GetSingleton())

/*-----------------------------------EOF!-----------------------------------*/